package net.neiquan.neiquandemowithkf.entity;

import java.io.Serializable;

/**
 * 作者 ： hjb
 * 时间 ： 2016/7/25.
 */

public class MyUser implements Serializable {
    private String nickName;
    private String headUrl;
    private String phone;
    /**
     * initial letter for nickname
     */
    protected String initialLetter;

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public String getHeadUrl() {
        return headUrl;
    }

    public void setHeadUrl(String headUrl) {
        this.headUrl = headUrl;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }


    public String getInitialLetter() {
        if (initialLetter == null) {
            UserLetterUtils.setUserInitialLetter(this);
        }
        return initialLetter;
    }

    public void setInitialLetter(String initialLetter) {
        this.initialLetter = initialLetter;
    }

    @Override
    public int hashCode() {
        return 17 * getPhone().hashCode();
    }

    @Override
    public boolean equals(Object o) {
        if (o == null || !(o instanceof MyUser)) {
            return false;
        }
        return getPhone().equals(((MyUser) o).getPhone());
    }

    @Override
    public String toString() {
        return nickName == null ? phone : nickName;
    }
}

